const data = require('../pages/mine/coupon/moreList/data.js');
const http = require('../utils/http.js');

// 商品分类
const goodsType = () => {
    return http.request('GET', '/Goods/category')
}
// // 商品可用优惠券
// const goodsDiscounts = () => {
//     return http.request('GET', '/coupon/UserCouponUse',data)
// }

// 商品分类，分页查询
const goodsTypePage = (data) => {
    return http.request('POST', `/Goods/category/page`, data)
}

// 分页查询 商品信息
const getGoodsPages = (data) => {
    return http.request('POST', `/Goods/page`, data)
}

const getIndexPage = (data) => {
    return http.request('POST', '/Goods/indexPage', data)
}

const getIndexGood = (data) => {
    return http.request('POST', '/Index/indexGood', data)
}

// 获取商品详情
const goodsDetail = (params) => {
    return http.request('GET', `/Goods/detail/${params.id}?invitationId=${params.invitationId}`)
}

// 根据id查询商品分类
const goodsTypeById = (id) => {
    return http.request('GET', `/Goods/category/${id}`)
}

// 获取拼团商品
const getGroupList = (data) => {
    return http.request('POST', `/GoodsSpellGroup/page`, data)
}

// 根据商品id获取正在拼团的列表
const getGroupingList = (id) => {
    return http.request('GET', `/GoodsSpellGroup/${id}/record?status=2`)
}

// 获取我的库存-库存
const getMyStockGoods = (data) => {
    return http.request('POST', `/AgentWarehouse/current/page`, data)
}

// 获取秒杀商品列表
const getGoodsSkill = (data) => {
    return http.request('GET', `/goods/goods_skill`, data)
}

// 获取评论接口
const getGoodsEvaluate = (data) => {
    return http.request('GET', `/goods/goods_evaluate`, data)
}

// 获取评论总数与好评百分比
const getGoodsEvaluateCount = (data) => {
    return http.request('GET', `/goods/evaluate_count`, data)
}

// 获取秒杀商品详情
const getGoodsSkillDetails = (data) => {
    return http.request('GET', `/goods/kill_detail`, data)
}

module.exports = {
    goodsType,
    getGoodsPages,
    goodsDetail,
    goodsTypePage,
    goodsTypeById,
    getGroupList,
    getGroupingList,
    getMyStockGoods,
    getGoodsSkill,
    getGoodsEvaluate,
    getGoodsEvaluateCount,
    getGoodsSkillDetails,
    getIndexPage,
    getIndexGood
    // goodsDiscounts
}